home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98c.txt / 000105_icon-group-sender _Mon Dec 7 17:04:40 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id RAA19280
  4.     for icon-group-addresses; Mon, 7 Dec 1998 17:02:55 -0700 (MST)
  5. Message-Id: <199812080002.RAA19280@baskerville.CS.Arizona.EDU>
  6. Date: Mon, 7 Dec 1998 14:59:00 -0700
  7. From: swampler@noao.edu (Steve Wampler)
  8. Subject: Re: Past Keyword / Coexpr Help
  9. To: icon-group@optima.CS.Arizona.EDU
  10. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  11. Status: RO
  12.  
  13.  
  14.  
  15. MJE wrote:
  16. > I like Steve Wampler's answer.  Since "find" is a generator, presumably
  17. > this function will also behave as a generator.  I would still lobby for
  18. > the "past" keyword, but no complaints.
  19. > Mark
  20. > Steve Wampler wrote:
  21. > > 
  22. > > You can write your own string analysis function to implement past().
  23. > > 
  24. > > As I understand what you want, the following would work:
  25. > > 
  26. > > procedure past(s)
  27. > >    suspend (tab(find(s)),match(s))
  28. > > end
  29. > > 
  30. > Nevin Liber wrote:
  31. > > 
  32. > > 
  33. > > It has find(), and it is fairly trivial to write past() using find.  Here
  34. > > you go:
  35. > > 
  36. > >         procedure past(s1, s2, i1, i2)
  37. > > 
  38. > >                 suspend find(s1, s2, i1, i2) + *s1
  39. > > 
  40. > >         end
  41.  
  42. The advantage Nevin's has is that it behaves exactly the same as the other string
  43. analysis functions (i.e. you can supply the last three arguments and use it outside
  44. of string scanning).  It's probably slightly faster as well, but I doubt the difference
  45. would be noticable to most of us.
  46.  
  47. A compromise is:
  48.  
  49.    procedure past(s1,s2,i,j)
  50.          suspend (find(s1,s2,i,j),match(s1))
  51.    end
  52.  
  53. --
  54. Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
  55. The gods that smiled at your birth are now laughing openly. (Fortune Cookie)
  56.